import React ,{ ReactElement } from "react";
import {Link} from 'react-router-dom'
import css from './index.less'
import {INews} from './index'
export default function NewsList ({newsList = []}:{newsList:INews[]}):ReactElement{
    return <ul className={css.news}>
        {newsList.map((item,index) => (
        <li key={index}>
            <div className={css.pic}>
            <Link to={`/news/${item.id}`}><img src={item.pic} alt={item.title} /></Link>
            </div>
            <div className={css.title}>
            <Link to={`/news/${item.id}`}>{item.title}</Link>
            </div>
            <div className={css.date}>{item.date}</div>
        </li>
        ))}
    </ul>
}